﻿<%@ Page Title="" Language="C#" MasterPageFile="~/default.Master" AutoEventWireup="true" CodeBehind="RoomOccupancy.aspx.cs" Inherits="DelonixRegia.RoomOccupancy" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphPageTitle" runat="server">
    Room Occupancy Reporting - Delonix Regia
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
    <i class="fa fa-book"></i> Room Occupancy Reporting 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphSubtitle" runat="server">
    Check the occupancy of the rooms in Delonix Regia
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cphMain" runat="server">
    <asp:Panel ID="pnlFirstStep" runat="server">
    <div id="firstStep" class="panel panel-default" style="width: 800px; margin: 0 auto;">
        <div class="panel-heading">
            Room Occupancy Reporting
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        </div>
        <div class="panel-body">
            <div id="errorBox" class="alert alert-danger" style="display: none;">
            </div>
            <table class="nav-justified">
                <tr>
                    <td style="width: 765px">
                        <div class="text-center">
                            <small>Click on a date on the calendar to view a daily report, click on "select month" and "select week" to view a weekly or monthly report</small>
                        </div><br />
                        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                            <ContentTemplate>
                                <asp:Calendar ID="OccupancyCalendar" runat="server" Caption="Select Day/Week/Month" CellSpacing="2" DayNameFormat="Full" SelectionMode="DayWeekMonth" SelectMonthText="Select Month" SelectWeekText="Select Week" Width="765px" OnDayRender="OccupancyCalendar_DayRender"></asp:Calendar>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <table class="nav-justified">
                            <tr>
                                <td class="text-right" style="width: 352px">Time:</td>
                                <td>
                                    <asp:DropDownList ID="ddlTime" runat="server" CssClass="form-control" Width="188px">
                                        <asp:ListItem Selected="True">Select a time</asp:ListItem>
                                        <asp:ListItem>00:00:00</asp:ListItem>
                                        <asp:ListItem>01:00:00</asp:ListItem>
                                        <asp:ListItem>02:00:00</asp:ListItem>
                                        <asp:ListItem>03:00:00</asp:ListItem>
                                        <asp:ListItem>04:00:00</asp:ListItem>
                                        <asp:ListItem>05:00:00</asp:ListItem>
                                        <asp:ListItem>06:00:00</asp:ListItem>
                                        <asp:ListItem>07:00:00</asp:ListItem>
                                        <asp:ListItem>08:00:00</asp:ListItem>
                                        <asp:ListItem>09:00:00</asp:ListItem>
                                        <asp:ListItem>10:00:00</asp:ListItem>
                                        <asp:ListItem>11:00:00</asp:ListItem>
                                        <asp:ListItem>12:00:00</asp:ListItem>
                                        <asp:ListItem>13:00:00</asp:ListItem>
                                        <asp:ListItem>14:00:00</asp:ListItem>
                                        <asp:ListItem>15:00:00</asp:ListItem>
                                        <asp:ListItem>16:00:00</asp:ListItem>
                                        <asp:ListItem>17:00:00</asp:ListItem>
                                        <asp:ListItem>18:00:00</asp:ListItem>
                                        <asp:ListItem>19:00:00</asp:ListItem>
                                        <asp:ListItem>20:00:00</asp:ListItem>
                                        <asp:ListItem>21:00:00</asp:ListItem>
                                        <asp:ListItem>22:00:00</asp:ListItem>
                                        <asp:ListItem>23:00:00</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            
            <table class="nav-justified">
                <tr>
                    <td class="text-center">
                        <asp:Button ID="queryBut" runat="server" CssClass="btn btn-default btn-lg" OnClick="queryBut_Click" Text="Query" />
                        <br />
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Panel>

    <asp:Panel ID="pnlSecondStep" runat="server">
    <div class="panel panel-default" id="secondStep" style="display:none; width: 800px; margin: 0 auto;" aria-busy="True">
        <div class="panel-heading">
            Room Occupancy Report</div>

        <div class="panel-body">
            <div class="alert alert-danger" id="Div1" style="display: none;">
            </div>

            <table class="nav-justified" style="width: 781px">
                <tr>
                    <td><%--<asp:Button ID="PrintBut" runat="server" CssClass="btn btn-default btn-lg" OnClick="PrintBut_Click" Text="Print Report" />--%>
                        <asp:Button ID="PrintBut" runat="server" CssClass="btn btn-default btn-lg" OnClientClick="doPrint()" Text="Print Report" />
                            &nbsp<asp:Button ID="ExcelBut" runat="server" CssClass="btn btn-default btn-lg" OnClick="ExcelBut_Click" Text="Export to Excel" />
                            &nbsp<asp:Button ID="PDFBut" runat="server" CssClass="btn btn-default btn-lg" OnClick="PDFBut_Click" Text="Export to PDF" />
                        <br />
                        <asp:GridView ID="gvOccupancy" runat="server" Width="765px" AutoGenerateColumns="False" class="table table-bordered" Caption="Room Occupancy">
                            <Columns>
                                <asp:BoundField DataField="Children" HeaderText="Number of children" />
                                <asp:BoundField DataField="Adults" HeaderText="Number of adults" />
                                <asp:BoundField DataField="UnoccupiedRooms" HeaderText="Unoccupied Rooms" />
                                <asp:BoundField DataField="OccupiedRooms" HeaderText="Occupied Rooms" />
                                <asp:BoundField DataField="Date" HeaderText="Date" />
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td class="text-center" style="height: 22px"><a href="RoomOccupancy.aspx">&lt; Go back</a></td>
                </tr>
            </table>
        </div>
    </div>
        </asp:Panel>
    <script type="text/javascript">
        function transitionToSecondStep() {
            //$('#firstStep').hide('slide', { direction: 'left', easing: 'easeOutQuart', duration: 250 });
            $('#secondStep').delay(250).show('slide', { direction: 'right', easing: 'easeOutQuart', duration: 250 });
        }
    </script>

   <script>
       function doPrint() {
           var prtContent = document.getElementById('<%= gvOccupancy.ClientID %>');
            prtContent.border = 0; //set no border here
            var WinPrint = window.open('', '', 'left=100,top=100,width=1000,height=1000,toolbar=0,scrollbars=1,status=0,resizable=1');
            WinPrint.document.write(prtContent.outerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
        }
    </script>

</asp:Content>
